<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>成功</title>
</head>

<body>
    <?php echo $msg; ?>
        即将跳转到:
<?php
if ($goto) {
    echo "<a id='href' href='$goto'>$goto</a>";
} else {
    echo "<a id='href' href='javascript::void(0);' onclick='window.history.back(-1)'>来源页面</a>";
}
?>
        等待时间: <span id="wait"><?php echo $wait; ?></span>

        <script type="text/javascript">
            (function() {
                var wait = document.getElementById('wait');
                var href = document.getElementById('href').href;
                var interval = setInterval(function() {
                    var time = --wait.innerHTML;
                    if (time <= 0) {
<?php
if ($goto) {
    echo "location.href = href;";
} else {
    echo "window.history.back(-1);";
}
?>
                        clearInterval(interval);
                    };
                }, 1000);
            })();
        </script>
</body>

</html>
